package com.gy.api.mobile.app;

import com.gy.api.base.ApiIndex;
import com.gy.api.base.R;
import com.gy.api.pc.examine.domain.vo.ExamineLogVO;
import com.gy.api.pc.examine.service.IExamineService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@Api( tags = ApiIndex.TaskController)
@RequestMapping("/task/manage")
public class TaskController {

    @Autowired
    private IExamineService service;


    @ApiOperation("根据节点ID获取节点")
    @RequestMapping(value = "/node", method = RequestMethod.GET)
    @ResponseBody
    public R<ExamineLogVO> getNodeById(@ApiParam(value = "流程节点ID")@RequestParam String taskId) {
        return new R(service.getNodeById(taskId));
    }

    @ApiOperation("根据流程ID获取节点(审批记录)")
    @RequestMapping(value = "/nodes", method = RequestMethod.GET)
    @ResponseBody
    public R<List<ExamineLogVO>> getNodesByFlowId(@ApiParam(value = "流程实例ID")@RequestParam String flowId) {
        return new R(service.getNodesByFlowId(flowId));
    }


}
